package cbfg.rvadapter.selection.store

class MapStore<T : Any>(private val selections: MutableMap<T, Int>) : IStore<T> {
    override val items: Collection<T> = selections.keys

    override fun add(element: T, index: Int): Boolean = selections.put(element, index) != null

    override fun remove(element: T): Boolean = selections.remove(element) != null

    override fun clear() {
        selections.clear()
    }
}